﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Text.RegularExpressions;
using Microsoft.WindowsAzure.StorageClient;
using System.Diagnostics;

namespace Microsoft.WindowsAzure.Search
{
    class Query
    {
        public static int MakeQuery(List<String> queryTerms, String msgID)
        {
            return 0;
            //Stopwatch watch = new Stopwatch();
            //watch.Start();

            //CloudStorageAccount account = CloudStorageAccount.FromConfigurationSetting("IndexConnectionString");
            //CloudQueueClient queueClient = account.CreateCloudQueueClient();
            //CloudQueue queryQueue = queueClient.GetQueueReference("query");

            //String[] groupTerms = new String[range];
            //foreach (String term in queryTerms)
            //{
            //    int i = Math.Abs(term.GetHashCode() % range);
            //    if (groupTerms[i] == null)
            //        groupTerms[i] = "," + term;
            //    else
            //        groupTerms[i] = groupTerms[i] + "," + term;
            //}

            //int messageCount = 0;
            //for (int i = 0; i < range; i++)
            //{
            //    if (groupTerms[i] != null)
            //    {
            //        // <docNum, termID, msgID, terms>
            //        String message = docNum + "," + i + "," + msgID + groupTerms[i];
            //        CloudQueueMessage m = new CloudQueueMessage(message);
            //        queryQueue.AddMessage(m);
            //        messageCount++;
            //    }
            //}

            //watch.Stop();
            //Debug.WriteLine("Make Query Time: " + watch.ElapsedMilliseconds + " ms");
            //return messageCount;
        }
    }
} 
